package com.ruoyi.common.constant;

import lombok.AllArgsConstructor;
import lombok.Getter;

public class CouponConstants {

    @Getter
    @AllArgsConstructor
    public enum CouponStatusEnum {
        WAIT(0, "未开始"),
        AVAILABLE(1, "领取中"),
        FINISH(2, "已领完"),
        EXPIRED(3, "已过期"),
        NULL(-1, "全部"),
        ;
        private int value;
        private String desc;

        public static CouponStatusEnum match(int value) {
            for (CouponStatusEnum one : CouponStatusEnum.values()) {
                if (one.getValue() == value) {
                    return one;
                }
            }
            return CouponStatusEnum.NULL;
        }
    }

    @Getter
    @AllArgsConstructor
    public enum TypeEnum {
        MEMBER_DISCOUNT(0, "会员折扣"),
        FACE_VALUE(1, "代金"),
        DISCOUNT(2, "折扣"),
        NULL(-1, "异常"),
        ;
        private int value;
        private String desc;

        public static TypeEnum match(int value) {
            for (TypeEnum one : TypeEnum.values()) {
                if (one.getValue() == value) {
                    return one;
                }
            }
            return TypeEnum.NULL;
        }
    }


    @Getter
    @AllArgsConstructor
    public enum MemberCouponStatusEnum {
        NOT_USE(0, "未使用"),
        USED(1, "已使用"),
        FINISH(2, "已过期"),
        NULL(-1, "全部"),
        ;
        private int value;
        private String desc;

        public static MemberCouponStatusEnum match(int value) {
            for (MemberCouponStatusEnum one : MemberCouponStatusEnum.values()) {
                if (one.getValue() == value) {
                    return one;
                }
            }
            return MemberCouponStatusEnum.NULL;
        }
    }
}
